package com.zzyl.controller;

import cn.hutool.core.bean.BeanUtil;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.NursingProjectDto;
import com.zzyl.entity.NursingProject;
import com.zzyl.service.NursingProjectService;

import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/nursing_project")
@Api(tags = "护理项目")
public class NursingProjectController extends BaseController{

    @Autowired
    NursingProjectService nursingProjectService;
    @GetMapping()
    @ApiOperation(value = "分页查询合同信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "护理项目名称", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态", required = false, dataType = "int", paramType = "query")
    })
    public ResponseResult<PageResponse<NursingProjectVo>> selectByPage(Integer pageNum,
                                                                 Integer pageSize,
                                                                 String name,
                                                                 Integer status) {
        PageResponse<NursingProjectVo> pageInfo = nursingProjectService.selectByPage(pageNum, pageSize, name, status);
        return success(pageInfo);
    }
    @PostMapping
    @ApiOperation(value = "新增护理项目")
    public ResponseResult add(@RequestBody NursingProjectDto nursingProjectDto) {
        nursingProjectService.add(nursingProjectDto);
        return success();
    }
}
